﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using YouHP.Utility;

namespace YouHP.Model
{
    [Serializable]
    public class SymptomHistoryInfo : IHydratable
    {
        public int Id { get; set; }
        public int PRId { get; set; }               /*病人患病记录id*/
        public int DiseaseId { get; set; }
        public int SymptomId { get; set; }
        public int Type { get; set; }
        public string SymptomName { get; set; }
        public int DegreeValue { get; set; }        /*症状程度值*/
        public int SurveyId { get; set; }           /*该记录所属的SurveyId*/
        public DateTime RecordDate { get; set; }    /*纪录时间（病人数据对应的真实时间）*/
        public DateTime UpdateDate { get; set; }    /*提交时服务器当前时间*/
        public string Remark { get; set; }

        public int SymptomHistoryId { get; set; }   //在当前记录中使用

        public SymptomHistoryInfo()
        {
            Id = PRId = SymptomId = DiseaseId = SurveyId = - 1;
            DegreeValue = Constants.SYMPTOM_NONE;
            Type = Constants.PRIMARY_SYMPTOM;
        }

        #region IHydratable 成员
        public bool Fill(System.Data.IDataReader dr)
        {
            return false;
        }
        #endregion  
    }

    public class SymptomHistoryInfoComparer : IComparer<SymptomHistoryInfo>
    {
        public int Compare(SymptomHistoryInfo X, SymptomHistoryInfo Y)
        {
            int iRet = X.Type - Y.Type;
            if (0 != iRet)
            {
                return iRet;
            }
            iRet = X.SymptomId - Y.SymptomId;
            if (0 != iRet)
            {
                return iRet;
            }

            iRet = X.RecordDate.CompareTo(Y.RecordDate);
            return iRet;
        }

    }
}
